In depth Guide for Slavers Of Skyrim

Chapter:	Shady figure services
Modul: Shady Figure modul
-------------------------------------------
Written for: Stage 2
Version: Step 2 - V4
in the year of: 2025
Month: 1
Day: 7
-------------------------------------------

Shady figures exist on quest:
SLOSShadyQuest<Number>
<Number> == a unice number for each quest

Shady quest stored in the form of:
SLOSShadyQuestList

Uopn quest start up the quest need register the shady figure they claim to:
SLOSShadyQuestActorList

Active quest need add shady figure reference alias to faction:
SLOSShadyFigureDialogueFaction
(so the dialoge system know this figure is valid and registered inside a quest!)

When SLOSCore start all member of this list get started.

Each quest try to locate a shady figure, as all shady figure need to be member of:
SLOSShadyFigureFaction

Shady figures represented by the fallowing type of quests:
SLOSShadyQuestXX

Where XX means number of the quest, as evry shady figure needs own quest to represent it. Need copy of the base shady figure quest to evry single one.

The shady figures can provide varius services to player.
This actors represneting their self as bussnies man or man of many contacts that can make things get moving... for the right ammount of gold or... other services.

in general all of them smart, talk littile say a lot with few words. They are totaly untrostworthy. Selling information or using contacts to make things happen.
They are generaly the middle men that make the seller and buyer find each other... and profit for this service.

They offer player fallowing services:
-Captured follower buy back
-Captured mercanry buy back ( if player own location ) ( its part of normal slave trade )
-buy normal slaves to player ( evalated prices compered normal prices on marketplace values: 
---Sell price for slave is: = SlavePriceMarketPlaceSell + (SlavePriceShadyFigureSell )
-Sell Slaver weapos to player cost is = weapon price x 2 

-sell information about...
--exact trust level of slaver guild towards the player
--exact trust level fo the ring of zenithar toward the player
--exact statistic of the local region lord entity status, in other word the investigation status

-Sell spell:
--sense victims
--sense slaver
--Claim location

-finincal options:
--player can take loan to buy slaves, or followers this cost by default the cost of slave + 1 000 gold
--loans need ot payed back in 2 weeks or suffer consiquences
--player can invest to shady figure, this give by default 10% profit after investment evry week
--withdrawing your investment has own cost, 300 gold by default

offer payment to player for fallowings:
-infromation about the slaver guild inner workings ( recoverbele due taking books and notes from slavers, or as member of the guild information told to you )
-buy slaver tokens for 50% of the original price
-Recuit mercanarys if player own a location

Special options:

-information about:
--Slaver guild: let player know the guild trust level toward player, if any strike aginst player or its bases in progress
--Ring of Zenithar: let player know the ROZ trust level toward player
--Local lord: let player know the local lord how thinks about player, any strike aginst player in progress, any strike aginst any slaver base in progress the region where the shady figure belong.


risk of dealing what sady figures:
this totlay not trustoworthy figures going to sell infromation about the player and its activitys too
evry shadi figure has own trust toward the player, this trust based on how many gold player spent to shady figure.
evry week the trust level decrased by 1k gold, until reaches 0.
if player invest to shady figure the invested gold ammount is the new floor flor trust loss.

well the shady figure going to help the investigation... this happen only if player requested any non totaly legal service from shady figure:

-recuit mercanarys for own use
-buy normal slaves
-sell normal slaves
-buying slaver weapons

in case any one wondering if too many gold invested on shady figure the figure might just leave town and never come back...
of corse this case leave with all of the player gold! :D 


Scripting inner workings:

SLOSdialogueGeneral host most of shady realted dialoges.
uses 2 separate script to hold the realted functions and data.
SLOSDataDialogGeneralShadyScript  -- data
SLOSdialogGeneralShadyScript  -- functions

when player start talk about busniess a script run down to fill the local data about this specific shady who player talking.
When player give bussnies instructions the system apply changes the shady quest oriignal data storage AND the local data storage at the same time.

The local dialoges depend on the local data.

plus evry shady figure controled by own quest that represent the shady figure.
this quest named:
SLOSShadyQuestXX
(where XX the quest number starting from 00)

-----------------------------
Slave trade:
-----------------------------

this is one of the most complex sub system in use.so bear with me!
Slaves are stored slave arrays that part of storage script. this scripts attached to questst that represent each slaver base or trader.
Evry single of this quest part of a dedicated collector form list.

Shady slave trade script take all of the slaver guild form lists and checks them for slaves.
if finds at least one slave at any slave storage array adds the slave to the SLOSShadySlaveBuyList Formlist and after the slave adds the slave storage to!

this way in theory infiniate number of slaves and slave storages can be accesed trought the shady figure.
When player ask for slaves here is what happens:

the system load the 
SLOSShadySlaveBuyList

form list and start searcing for actors. when finds one displays it to player trought the message menu with it the slave stats.

player can switch to look the next slave. when player chose to do this the system turn the next page. load the next slave data from the list.
same time, if the enxt element on the list is a slave storage the system skips that page.

when the player chose to buy one slave the system use the loded data to remove gold from player and add to shady.
then the pre loaded data used to transfer the slave from the original storage to the player personal storage.
before this happen the system checks player personal storage has free space or not.
if not nothing will happen.

when slave trasnported to player storage removed from original storage, then slave transported to the player position.

its possible the slave got removed from its original storage before player chose to buy it. becuse slavers and slave oweners doing its own things... for this reason the system need run safety checks before conforming the slave buy.
if a slave run any truble the slave got removed from the list ( SLOSShadySlaveBuyList )
same thign happen if slave got brought by player.

if the list run out of elements or slaves the menu closes as nothing to sold to player exist.
this way if multiple error occur becuse slaves moved as player dicide what to do, player forced to re open the menu and new list can be created.

-----------------------------
information:
-----------------------------

Shady figure give out localy revelant information. When asked local lords checks the hold where is shady figure exist, based on this find the revelant local lord region, and load the revelent data.
if the locals no evidence aginst the player and trust on player not negative shady say all okay.
Other cases shady tell the hard turth: if the locals has evidence on player let player know the evidence level, if locals going to strike a slaver base let player know they going after a slaver base but not name where.
Shady not tell the player if the locals going after the player...

-if asked on slaver guild:
tell slaver guild trust level, if slaver guild on its player or not, if a slaver base that player owns under attack by slaver guild.
the guild trust come from global vairable, all other data from slosSlaverguildEntity quest. Data script.

-if asked ring of zenithar:
tell the trust level of ring of zenithar to player.
based on global variable

-----------------------------
Shady figure vanish:
-----------------------------

-shady figure can decide to wanish if player put too mutch gold investment on the shady figure. this calculated end of each cycle.
al lshady figure has own calulation run when cycle ends...
this done by the script named:
SLOSShadyCycleEndScript 

the ammount of gold shady accont to mutch registered in shady data script under variable: leaveinvestmentlimit
this limit chosen when the shady figure quest setup done, the setup call random number 0 to 1.
here is the calulation formula:
leaveinvestmentlimit = ( CoreCode.CallGetRandomNumber() * 3350 )+2600

this means minimum 2 600 gold, maximum 2 600 + 33 500 = 36 100 gold.
the player not informed about this data...

End of cycle the mark when player trust gold decrased, this value show how mutch shady trust on player.
if the trust lover than the information that shady gathered on player the shady going to sell the information to local entity this way incrasing evidence on player.
evry cycle the player trust gold reduced by 1 000 gold.

the investment considered permanent incrase of trust gold, this means trust gold never go below this level.

during the cycle the loand handling happen too.
if player run out of the loan pay back time first shady send a message to player to give back the loan same time setup a variable.

logic here is this:
Cylce end script call the script named:
SLOSShadyLoanScript 

-----------------------------
The depth and loan system:
-----------------------------

this loan script control the loan handling events.

send vannila messenger to player or the whatan varriors if player fail to pay in time the loan.

Bool Function SendCollector( int aiEscalation )

function used to send the wariors return true if team sent, return false if for any reason unable to send the team.
To colelctors start work fallowing parameters need to changed:

CoreCode.SLOSShadyFigureCollectorMode - Global variable, need to be higher than 0, this tells the collectors how sirus the depth situation is 1 is first visit 2 is secund visit, 3 is final visit
CoreCode.ShadyCollectorStarterQuest - this variable sotres the starter quest that ordered the collectors to start working, as multiple shady figure may exist same time need keep track who started the action
so the loan here can be cleared.

in case the colelctor quest finished running need call back this function:
Function CollectorQuestDone()

its signals the collector quest finished running and sets the global variable:
CoreCode.SLOSShadyFigureCollectorMode
to zero this way signaling no collection active.

the colection team controled by SLOSShadyLoanCollectorQST quest.
this quest started by change location event if the global variable larger than zero ( CoreCode.SLOSShadyFigureCollectorMode ) and the new location is a settlement keyworded.

this case spawns the required number of whatan warrior and the grup leader aproches the player force great it and present the message pay the depth! with gold, or items or in last resort at final visit go to slavery!
wathan variors accept 500 gold as initial payment this give them some time but latter point they going to visit agin... if depth not payed.

Evry visit cost gold the player that added to depth! in sort the wathan varior visit cost need ot payed by player!

Player can chose give out items to as payment, this case the items nominal value 40% counted as payment, not 100% as player may expect. these items stored temeplary if the given out items total cost whit 60% discount not go above 500 gold the item given back to player.
if the whatan wariors accept the payment the items stored the talking warrior.

in case player visited the final time ( 3th ) and fail to pay enught gold ( 500 gold minimum ), the colelctors attemt enslave player, first due dialoge if its fails... they have slaver weapons.
and able to capture the player.

The warriors despawn with item/gold after player leve the location. but player can steal back items. if wish. the depth or part of considered payed.